package com.jy.wms.controller;

import com.github.pagehelper.Page;
import com.joyi.gate.comm.SessionInfo;
import com.joyi.gate.safety.vo.UserInfo;
import com.jy.wms.common.ExportUtils;
import com.jy.wms.common.SetStatus;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.BaseSessionInfo;
import com.jy.wms.common.base.JsonResult;
import com.jy.wms.common.base.ServiceException;
import com.jy.wms.pojo.*;
import com.jy.wms.service.WmsProvinceRankingReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: WmsProvinceRankingReportController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author lqc
 * @Date Thu Mar 22 18:05:51 CST 2018
 */
@RestController
@RequestMapping("/wmsprovincerankingreport")
@Api(value = "/wmsprovincerankingreport", description = "省市报表")
public class WmsProvinceRankingReportController extends BaseController<WmsProvinceRankingReportService, WmsProvinceRankingReport> {



    @PostMapping(value = "getWmsProvinceRankingReport")
    @ApiOperation(value = "直销省市排名", response = JSONObject.class, notes = "POST查看直销省市排名")
    public @ResponseBody
    JSONObject getwmsprovincerankingreportbyid(@RequestBody DirectSellingprovinces mapp, HttpSession session) {
        JSONObject json = null;
        //获取当前操作用户的货主id
        List<SysHz> hz = (List<SysHz>) session.getAttribute(BaseSessionInfo.SessionConsignor);
        String hzid = hz.get(0).getHzid();
        //获取仓库Id
        UserInfo userinfo = (UserInfo) session.getAttribute(SessionInfo.USER_INFO);
        String ckid = userinfo.getUser().getOrgId().get(0).toString();

        json = baseService.baseselectbyprimarykey(mapp, hzid, ckid);
        return json;
    }
}
